---
title: Getting Started
description: Quick start guide to using Alchemy, the TypeScript-native Infrastructure-as-Code library. Deploy your first Cloudflare Worker with type-safe infrastructure code.
---

import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';

Alchemy is a simple TypeScript script that you run to deploy infrastructure. All you need is a Node.js runtime and a Cloudflare account to get started.

:::tip
This guide will walk through manually creating the project. 
Alternatively, you can use the `alchemy create` command to generate a new project.

<Tabs syncKey="pkgManager">
  <TabItem label="bun">
    ```sh
    bunx alchemy@latest create --template typescript
    ```
  </TabItem>
  <TabItem label="npm">
    ```sh
    npx alchemy@latest create --template typescript
    ```
  </TabItem>
  <TabItem label="pnpm">
    ```sh
    pnpx alchemy@latest create --template typescript
    ```
  </TabItem>
  <TabItem label="yarn">
    ```sh
    yarn dlx alchemy@latest create --template typescript
    ```
  </TabItem>
</Tabs>
:::


<Steps>

1. **Create your project**

   Start by creating a new project and installing Alchemy.

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun init -y
       bun add alchemy
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npm init -y
       npm install alchemy
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm init
       pnpm add alchemy
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn init -y
       yarn add alchemy
       ```
     </TabItem>
   </Tabs>

2. **Configure your profile**

   Set up a profile to manage your cloud provider credentials.

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy configure
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy configure
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy configure
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy configure
       ```
     </TabItem>
   </Tabs>

   :::note
   Profiles help you manage credentials for cloud providers. Learn more about [profiles](/concepts/profiles) and how to configure multiple accounts.
   :::

3. **Login to Cloudflare**

   Authenticate with your Cloudflare account.

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy login
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy login
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy login
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy login
       ```
     </TabItem>
   </Tabs>



   :::tip
   Make sure you have a [Cloudflare account](https://dash.cloudflare.com/sign-up) (free tier works)
   :::

4. **Create your infrastructure**

   Create `alchemy.run.ts` with a simple Worker:

   ```typescript
   import alchemy from "alchemy";
   import { Worker } from "alchemy/cloudflare";

   const app = await alchemy("my-first-app");

   const worker = await Worker("hello-worker", {
     entrypoint: "./src/worker.ts",
   });

   console.log(`Worker deployed at: ${worker.url}`);
   await app.finalize();
   ```

5. **Create your worker code**

   Create `src/worker.ts`:

   ```typescript
   export default {
     async fetch(request: Request): Promise<Response> {
       return Response.json({
         message: "Hello from Alchemy!",
         timestamp: new Date().toISOString(),
       });
     },
   };
   ```

6. **Start development mode**

   Use the Alchemy CLI to run in development mode with hot reloading:

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy dev
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy dev
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy dev
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy dev
       ```
     </TabItem>
   </Tabs>

   Your worker will be available locally with live updates as you edit your code.

7. **Make a change**

   Update your worker message in `src/worker.ts`:

   ```typescript
   message: "Hello from Alchemy! 🧪",
   ```

   Save the file and see the change reflected immediately.

8. **Deploy to production**

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy deploy
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy deploy
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy deploy
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy deploy
       ```
     </TabItem>
   </Tabs>

   Visit the URL to see your worker live on Cloudflare's edge network.

9. **(Optional) Tear down**

   Use the Alchemy CLI to delete all of the resources:

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy destroy
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy destroy
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy destroy
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy destroy
       ```
     </TabItem>
   </Tabs>

</Steps>


You've successfully deployed your first Cloudflare Worker with Alchemy! Here are some next steps:

- [Learn about the Alchemy CLI](/concepts/cli) - Complete command reference and options
- [Deploy a ViteJS site to Cloudflare](/guides/cloudflare-vitejs) - Build full-stack applications
- [Learn about Cloudflare Workers](/guides/cloudflare-worker) - Advanced worker features
- [Build your own Custom Resource](/guides/custom-resources) - Extend Alchemy